function generateUUID() {
    var d = new Date().getTime();
    var uuid = 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
        var r = (d + Math.random() * 16) % 16 | 0;
        d = Math.floor(d / 16);
        return (c == 'x' ? r : (r & 0x7 | 0x8)).toString(16);
    });
    return UUID(uuid);
};
var clvl2 = db.CriteriaLevel2.findOne({Name: /Ratings/});

var rank = {
    "_id" : generateUUID(),
    "Name" : "Rank",
    "ShortName" : "",
    "Order" : 228,
    "CriteriaLevel2Id" : clvl2._id
};
db.CriteriaLevel3.save(rank);
var rankT=
{
    "_id" : generateUUID(),
    "Name" : "Rank",
    "CriteriaEntity" : "RPCompanyESGComputationResult",
    "CriteriaEntityField" : "OverallPerformance.Rank",
    "CriteriaType" : 6,
    "CriteriaLevel2Id" : clvl2._id,
    "CriteriaLevel3Id" : rank._id,
    "IsScreenable" : true
}
db.TemplateCriteria.save(rankT);

var environmentrank = {
    "_id" : generateUUID(),
    "Name" : "Environment Rank",
    "ShortName" : "",
    "Order" : 229,
    "CriteriaLevel2Id" : clvl2._id
};
db.CriteriaLevel3.save(environmentrank);
var environmentrankT=
{
    "_id" : generateUUID(),
    "Name" : "Environment Rank",
    "CriteriaEntity" : "RPCompanyESGComputationResult",
    "CriteriaEntityField" : "EnvironmentPerformance.Rank",
    "CriteriaType" : 6,
    "CriteriaLevel2Id" : clvl2._id,
    "CriteriaLevel3Id" : environmentrank._id,
    "IsScreenable" : true
}
db.TemplateCriteria.save(environmentrankT);

var socialrank = {
    "_id" : generateUUID(),
    "Name" : "Social Rank",
    "ShortName" : "",
    "Order" : 230,
    "CriteriaLevel2Id" : clvl2._id
};
db.CriteriaLevel3.save(socialrank);
var socialrankT=
{
    "_id" : generateUUID(),
    "Name" : "Social Rank",
    "CriteriaEntity" : "RPCompanyESGComputationResult",
    "CriteriaEntityField" : "SocialPerformance.Rank",
    "CriteriaType" : 6,
    "CriteriaLevel2Id" : clvl2._id,
    "CriteriaLevel3Id" : socialrank._id,
    "IsScreenable" : true
}
db.TemplateCriteria.save(socialrankT);

var governancerank = {
    "_id" : generateUUID(),
    "Name" : "Governance Rank",
    "ShortName" : "",
    "Order" : 231,
    "CriteriaLevel2Id" : clvl2._id
};
db.CriteriaLevel3.save(governancerank);
var governancerankT=
{
    "_id" : generateUUID(),
    "Name" : "Governance Rank",
    "CriteriaEntity" : "RPCompanyESGComputationResult",
    "CriteriaEntityField" : "GovernancePerformance.Rank",
    "CriteriaType" : 6,
    "CriteriaLevel2Id" : clvl2._id,
    "CriteriaLevel3Id" : governancerank._id,
    "IsScreenable" : true
}
db.TemplateCriteria.save(governancerankT);
//

var percentile = {
    "_id" : generateUUID(),
    "Name" : "Percentile",
    "ShortName" : "",
    "Order" : 232,
    "CriteriaLevel2Id" : clvl2._id
};
db.CriteriaLevel3.save(percentile);
var percentileT=
{
    "_id" : generateUUID(),
    "Name" : "Percentile",
    "CriteriaEntity" : "RPCompanyESGComputationResult",
    "CriteriaEntityField" : "OverallPerformance.Percentile",
    "CriteriaType" : 6,
    "CriteriaLevel2Id" : clvl2._id,
    "CriteriaLevel3Id" : percentile._id,
    "IsScreenable" : true
}
db.TemplateCriteria.save(percentileT);

var environmentpercentile = {
    "_id" : generateUUID(),
    "Name" : "Environment Percentile",
    "ShortName" : "",
    "Order" : 233,
    "CriteriaLevel2Id" : clvl2._id
};
db.CriteriaLevel3.save(environmentpercentile);
var environmentpercentileT=
{
    "_id" : generateUUID(),
    "Name" : "Environment Percentile",
    "CriteriaEntity" : "RPCompanyESGComputationResult",
    "CriteriaEntityField" : "EnvironmentPerformance.Percentile",
    "CriteriaType" : 6,
    "CriteriaLevel2Id" : clvl2._id,
    "CriteriaLevel3Id" : environmentpercentile._id,
    "IsScreenable" : true
}
db.TemplateCriteria.save(environmentpercentileT);

var socialpercentile = {
    "_id" : generateUUID(),
    "Name" : "Social Percentile",
    "ShortName" : "",
    "Order" : 234,
    "CriteriaLevel2Id" : clvl2._id
};
db.CriteriaLevel3.save(socialpercentile);
var socialpercentileT=
{
    "_id" : generateUUID(),
    "Name" : "Social Percentile",
    "CriteriaEntity" : "RPCompanyESGComputationResult",
    "CriteriaEntityField" : "SocialPerformance.Percentile",
    "CriteriaType" : 6,
    "CriteriaLevel2Id" : clvl2._id,
    "CriteriaLevel3Id" : socialpercentile._id,
    "IsScreenable" : true
}
db.TemplateCriteria.save(socialpercentileT);

var governancepercentile = {
    "_id" : generateUUID(),
    "Name" : "Governance Percentile",
    "ShortName" : "",
    "Order" : 235,
    "CriteriaLevel2Id" : clvl2._id
};
db.CriteriaLevel3.save(governancepercentile);
var governancepercentileT=
{
    "_id" : generateUUID(),
    "Name" : "Governance Percentile",
    "CriteriaEntity" : "RPCompanyESGComputationResult",
    "CriteriaEntityField" : "GovernancePerformance.Percentile",
    "CriteriaType" : 6,
    "CriteriaLevel2Id" : clvl2._id,
    "CriteriaLevel3Id" : governancepercentile._id,
    "IsScreenable" : true
}
db.TemplateCriteria.save(governancepercentileT);
//

var splcode = {
    "_id" : generateUUID(),
    "Name" : "SPL Code",
    "ShortName" : "",
    "Order" : 237,
    "CriteriaLevel2Id" : clvl2._id
};
db.CriteriaLevel3.save(splcode);
var splcodeT=
{
    "_id" : generateUUID(),
    "Name" : "SPL Code",
    "CriteriaEntity" : "CorporateData",
    "CriteriaEntityField" : "SPLCode",
    "CriteriaType" : 6,
    "CriteriaLevel2Id" : clvl2._id,
    "CriteriaLevel3Id" : splcode._id,
    "IsScreenable" : false
}
db.TemplateCriteria.save(splcodeT);
//
var cgEnv = {
    "_id" : generateUUID(),
    "Name" : "Comparative Group Average Environment",
    "ShortName" : "",
    "Order" : 238,
    "CriteriaLevel2Id" : clvl2._id
};
db.CriteriaLevel3.save(cgEnv);
var cgEnvT=
{
    "_id" : generateUUID(),
    "Name" : "Comparative Group Average Environment",
    "CriteriaEntity" : "RPCompanyESGComputationResult",
    "CriteriaEntityField" : "EnvironmentPerformance.Avg",
    "CriteriaType" : 6,
    "CriteriaLevel2Id" : clvl2._id,
    "CriteriaLevel3Id" : cgEnv._id,
    "IsScreenable" : true
}
db.TemplateCriteria.save(cgEnvT);

var cgAs = {
    "_id" : generateUUID(),
    "Name" : "Comparative Group Average Social",
    "ShortName" : "",
    "Order" : 239,
    "CriteriaLevel2Id" : clvl2._id
};
db.CriteriaLevel3.save(cgAs);
var cgAsT=
{
    "_id" : generateUUID(),
     "Name" : "Comparative Group Average Social",
    "CriteriaEntity" : "RPCompanyESGComputationResult",
    "CriteriaEntityField" : "SocialPerformance.Avg",
    "CriteriaType" : 6,
    "CriteriaLevel2Id" : clvl2._id,
    "CriteriaLevel3Id" : cgAs._id,
    "IsScreenable" : true
}
db.TemplateCriteria.save(cgAsT);

var cgG = {
    "_id" : generateUUID(),
    "Name" : "Comparative Group Average Governance",
    "ShortName" : "",
    "Order" : 240,
    "CriteriaLevel2Id" : clvl2._id
};
db.CriteriaLevel3.save(cgG);
var cgGT=
{
    "_id" : generateUUID(),
     "Name" : "Comparative Group Average Governance",
    "CriteriaEntity" : "RPCompanyESGComputationResult",
    "CriteriaEntityField" : "GovernancePerformance.Avg",
    "CriteriaType" : 6,
    "CriteriaLevel2Id" : clvl2._id,
    "CriteriaLevel3Id" : cgG._id,
    "IsScreenable" : true
}
db.TemplateCriteria.save(cgGT);
//
/* var analystComentary = {
    "_id" : generateUUID(),
    "Name" : "Analyst Commentary",
    "ShortName" : "",
    "Order" : 241,
    "CriteriaLevel2Id" : clvl2._id
};
db.CriteriaLevel3.save(analystComentary);
var analystComentaryT=
{
    "_id" : generateUUID(),
    "Name" : "Analyst Commentary",
    "CriteriaEntity" : "CorporateData",
    "CriteriaEntityField" : "AnalystCommentary",
    "CriteriaType" : 6,
    "CriteriaLevel2Id" : clvl2._id,
    "CriteriaLevel3Id" : analystComentary._id,
    "IsScreenable" : false
}
db.TemplateCriteria.save(analystComentaryT);
//
var key1 = {
    "_id" : generateUUID(),
    "Name" : "Key ESG Issue 1",
    "ShortName" : "",
    "Order" : 242,
    "CriteriaLevel2Id" : clvl2._id
};
db.CriteriaLevel3.save(key1);
var key1T=
{
    "_id" : generateUUID(),
    "Name" : "Key ESG Issue 1",
    "CriteriaEntity" : "",
    "CriteriaEntityField" : "FirstKeyESGIssue",
    "CriteriaType" : 6,
    "CriteriaLevel2Id" : clvl2._id,
    "CriteriaLevel3Id" : key1._id,
    "IsScreenable" : false
}
db.TemplateCriteria.save(key1T);

var key2 = {
    "_id" : generateUUID(),
    "Name" : "Key ESG Issue 2",
    "ShortName" : "",
    "Order" : 243,
    "CriteriaLevel2Id" : clvl2._id
};
db.CriteriaLevel3.save(key2);
var key2T=
{
    "_id" : generateUUID(),
    "Name" : "Key ESG Issue 2",
    "CriteriaEntity" : "",
    "CriteriaEntityField" : "SecondKeyESGIssue",
    "CriteriaType" : 6,
    "CriteriaLevel2Id" : clvl2._id,
    "CriteriaLevel3Id" : key2._id,
    "IsScreenable" : false
}
db.TemplateCriteria.save(key2T);

var key3 = {
    "_id" : generateUUID(),
    "Name" : "Key ESG Issue 3",
    "ShortName" : "",
    "Order" : 244,
    "CriteriaLevel2Id" : clvl2._id
};
db.CriteriaLevel3.save(key3);
var key3T=
{
    "_id" : generateUUID(),
    "Name" : "Key ESG Issue 3",
    "CriteriaEntity" : "",
    "CriteriaEntityField" : "ThirdKeyESGIssue",
    "CriteriaType" : 6,
    "CriteriaLevel2Id" : clvl2._id,
    "CriteriaLevel3Id" : key3._id,
    "IsScreenable" : false
}
db.TemplateCriteria.save(key3T);

 */